
import UIKit

/// draw the outline for text of the label
@IBDesignable class UIOutlinedLabel: UILabel {
    
    @IBInspectable var outlineWidth: CGFloat = 1
    @IBInspectable var outlineColor: UIColor = UIColor.white
    
    override func drawText(in rect: CGRect) {
        
        self.attributedText = NSAttributedString(string: self.text ?? "", attributes: [
            NSAttributedString.Key.strokeColor : outlineColor,
            NSAttributedString.Key.strokeWidth : -1 * outlineWidth,
            ])
        super.drawText(in: rect)
    }
}

